feat: add separate tsconfig for test files#4616
Conversation
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (10)
WalkthroughAdds a test-scoped TypeScript config at ChangesFrontend tests & CI wiring
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Warning
CodeRabbit couldn't request changes on this pull request because it doesn't have sufficient GitHub permissions.
Please grant CodeRabbit Pull requests: Read and write permission and re-run the review.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@frontend/__tests__/tsconfig.json`:
- Around line 4-8: Remove the "@testing-library/jest-dom" entry from the
tsconfig "types" array because it causes TS2688 with v6+; instead rely on the
import in jest.setup.ts (configured via setupFilesAfterEnv) which already
provides the globals, so edit the "types" array to omit
"@testing-library/jest-dom" and keep "jest" and "node" intact.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: b0529400-fc0b-489b-b564-5cc6f7b34469
📒 Files selected for processing (1)
frontend/__tests__/tsconfig.json
|
@arkid15r , at the moment the "test:a11y": "NODE_OPTIONS='--experimental-vm-modules --no-warnings=DEP0040' jest __tests__/a11y/ --coverage=false",
"test:unit": "tsc --noEmit && NODE_OPTIONS='--experimental-vm-modules --no-warnings=DEP0040' jest"however i was wondering that since |
…excluded in parent tsconfig.json
Yes, I think it'd be structurally better approach. Just make sure it's all backward compatible. Thanks! |
|
Alright 👍 |
2671ac1
|
swc jset uses |
arkid15r
left a comment
There was a problem hiding this comment.
I'll update and merge this PR soon, please don't add any changes.
There was a problem hiding this comment.
The main issue with the PR (your approach actually) it's that you don't follow the contribution workflow even though you marked the relevant checkbox 🤷♂️
There was a problem hiding this comment.
2b177dd
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4616 +/- ##
=======================================
Coverage 98.92% 98.92%
=======================================
Files 527 527
Lines 16956 16956
Branches 2360 2412 +52
=======================================
Hits 16774 16774
Misses 97 97
Partials 85 85
Flags with carried forward coverage won't be shown. Click here to find out more. Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@frontend/__tests__/a11y/components/RecentPullRequests.a11y.test.tsx`:
- Around line 56-57: The test fixture in RecentPullRequests.a11y.test.tsx has an
inconsistent PR object with state: 'open' but a mergedAt timestamp; update the
fixture to be realistic by either setting state to 'merged' (so mergedAt remains
valid) or removing the mergedAt field if the PR should be open—locate the PR
object in the RecentPullRequests.a11y.test.tsx test case and adjust the state or
mergedAt accordingly to keep the fixture consistent with GraphQL DateTime ISO
string conventions.
In `@frontend/__tests__/a11y/components/SingleModuleCard.a11y.test.tsx`:
- Around line 60-61: The fixture mockModule uses startedAt as a numeric Unix
timestamp while endedAt is an ISO string; update startedAt to an ISO 8601 string
to match endedAt (e.g., new Date(1704067200 * 1000).toISOString()) so both
timestamp fields use the same type expected by the Module/GraphQL DateTime
serialization; ensure you update any tests that rely on numeric timestamps to
use the ISO string form as well.
In `@frontend/__tests__/unit/components/SingleModuleCard.test.tsx`:
- Around line 113-114: The test fixture in SingleModuleCard.test.tsx uses mixed
date formats: startedAt is a numeric Unix timestamp while endedAt is an ISO
string; update the fixture so both DateTime fields are ISO 8601 strings (e.g.,
set startedAt to new Date(1704067200 * 1000).toISOString() or an equivalent ISO
string) so startedAt and endedAt are consistent with GraphQL DateTime
serialization and the component's runtime expectations.
In `@frontend/__tests__/unit/components/SnapshotCard.test.tsx`:
- Around line 52-60: The test is using "0 as unknown as string" to simulate
missing dates which hides intent; update the two calls to render/rerender of
SnapshotCard to pass an explicit missing sentinel (prefer undefined or null,
e.g. startAt={undefined} and endAt={undefined}) instead of the type-coerced 0,
keeping the same asserts; if TypeScript complaints, adjust the test props by
casting only the prop (e.g. startAt={undefined as unknown as string} or widen
defaultProps type) so you change lines that set startAt/endAt in the render and
rerender calls for SnapshotCard and leave formatDate and expectations unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 92e7be3c-7abd-4093-9254-f8ac70f555d1
⛔ Files ignored due to path filters (1)
frontend/pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (29)
.pre-commit-config.yamldocker/frontend/Dockerfile.a11y.testdocker/frontend/Dockerfile.unit.testfrontend/__tests__/a11y/components/CardDetailsPage.a11y.test.tsxfrontend/__tests__/a11y/components/LeadersList.a11y.test.tsxfrontend/__tests__/a11y/components/MentorshipPullRequest.a11y.test.tsxfrontend/__tests__/a11y/components/ModuleCard.a11y.test.tsxfrontend/__tests__/a11y/components/ProgramCard.a11y.test.tsxfrontend/__tests__/a11y/components/RecentPullRequests.a11y.test.tsxfrontend/__tests__/a11y/components/RecentRelease.a11y.test.tsxfrontend/__tests__/a11y/components/RecentReleases.a11y.test.tsxfrontend/__tests__/a11y/components/Release.a11y.test.tsxfrontend/__tests__/a11y/components/RepositoryCard.a11y.test.tsxfrontend/__tests__/a11y/components/SingleModuleCard.a11y.test.tsxfrontend/__tests__/a11y/components/ToggleableList.a11y.test.tsxfrontend/__tests__/jest.setup.tsfrontend/__tests__/tsconfig.jsonfrontend/__tests__/unit/components/CardDetailsPage.test.tsxfrontend/__tests__/unit/components/HealthMetrics.test.tsxfrontend/__tests__/unit/components/ItemCardList.test.tsxfrontend/__tests__/unit/components/RecentRelease.test.tsxfrontend/__tests__/unit/components/Release.test.tsxfrontend/__tests__/unit/components/RepositoryCard.test.tsxfrontend/__tests__/unit/components/SingleModuleCard.test.tsxfrontend/__tests__/unit/components/SnapshotCard.test.tsxfrontend/__tests__/unit/utils/getIcsFileUrl.test.tsfrontend/jest.config.tsfrontend/package.jsonfrontend/tsconfig.json
💤 Files with no reviewable changes (1)
- frontend/tests/unit/components/HealthMetrics.test.tsx
|



Proposed change
Resolves #4571
Add the PR description here.
tsconfiginfrontend/tsconfig.jsonexcludestestdirectory. this causes for lsp unable to pick up any globals/methods from jest libraries . This pr adds a separatetsconfig.jsoninfrontend/__tests__.Checklist
make check-testlocally: all warnings addressed, tests passed